package com.itmeima.text2;


import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;


public class Demo1 {
    public static void main(String[] args) throws Exception {

        Class clazz = Class.forName("com.itmeima.text2.Student");

        Constructor constructor = clazz.getConstructor(String.class, int.class);

        constructor.setAccessible(true);
        Student student = (Student) constructor.newInstance("张三", 23);

        Method method = clazz.getDeclaredMethod("showInfo");

        method.setAccessible(true);

        method.invoke(student);


    }
}
